<template>
	<div>
		
		<van-grid v-if="searchResult.length" :border="false" :column-num="2" :center='false'>
			<van-grid-item v-for="(item,index) in searchResult" :key='index' @click="ware(item)">
				<van-image :src="item.pic" />
				<div style="height: 2.625rem;"> {{ item.title }} </div>
				<div class="price">￥{{ item.price }} </div>
			</van-grid-item>
		</van-grid>
		<van-empty image="search" v-else description="当前暂无商品" />
		
	</div>
</template>

<script>
	import {
		mapState
	} from 'vuex'

	export default {
		name: 'SearchList',
		computed: {
			...mapState('commodityList', ['searchResult'])
		},
		methods: {
			ware(item){
				console.log(item)
				this.$router.push({name:'ware',query: {ware:JSON.stringify(item)}})
			},
		},
	}
</script>

<style scoped>
	.price {
		color: #b0352f;
		font-size: 1.25rem;
	}
</style>
